/**CourageAQ*/
function getDate(date){
	var date = new Date(date);
	/*alert(date);
	alert(date.getTime());*/
	
	var year = date.getFullYear() + "-" + getDateFormatMonth((date.getMonth()+1)) + "-" +(date.getDate()-1);
	var time = (date.getHours()+10) + ":" + date.getMinutes();
	return year+ " " +time;
};
function getDateFormatMonth(month){
	if(month == 1){
		return "01";
	}else if(month == 2){
		return "02";
	}else if(month == 3){
		return "03";
	}else if(month == 4){
		return "04";
	}else if(month == 5){
		return "05";
	}else if(month == 6){
		return "06";
	}else if(month == 7){
		return "07";
	}else if(month == 8){
		return "08";
	}else if(month == 9){
		return "09";
	}else{
		return "" + month+"";
	}
};
/***时间戳转换获取yyyy-MM-dd hh:mm*/
function getLocalTime(nS) {       
    return  new Date(parseInt(nS)).Format("yyyy-MM-dd hh:mm");    
} 
/***时间戳转换获取yyyy-MM-dd*/
function getLocalDate(nS) {       
    return  new Date(parseInt(nS)).Format("yyyy-MM-dd");    
}  
Date.prototype.Format = function (fmt) { //author: meizz   
        var o = {  
            "M+": this.getMonth() + 1, //月份   
            "d+": this.getDate(), //日   
            "h+": this.getHours(), //小时   
            "m+": this.getMinutes(), //分   
            "s+": this.getSeconds(), //秒   
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度   
            "S": this.getMilliseconds() //毫秒   
        };  
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
        for (var k in o)  
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));  
        return fmt;  
};
//获得本周的开端日期 
function formatDateDays() {
    var now = new Date;
    var day = now.getDay();
    var week = "1234560";
    var first = 0 - week.indexOf(day);
    var f = new Date;
    f.setDate(f.getDate() + first);
    var starttime = formatDate(f);
    var endtime =  formatDate(now);
    var times = [starttime,endtime];
    return times;
}

function formatTen(num) {
    return num > 9 ? (num + "") : ("0" + num);
}

function formatDate(date) {
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var hour = date.getHours();
    var minute = date.getMinutes();
    var second = date.getSeconds();
    return year + "-" + formatTen(month) + "-" + formatTen(day);
}
function formatDateString(date) {
	var d = new Date(date.replace(/-/g, '/'));
	var month = '' + (d.getMonth() + 1);
	var day = '' + d.getDate();
	var year = d.getFullYear();
	if (month.length < 2){
		month = '0' + month;
	} 
	if (day.length < 2) day = '0' + day;
	return [year, month, day].join('-');
}